unit common;
interface

Type
   myreal   = real;
   mystring = string[128];
Const
   tdim	       = 1000;
   t_ele       = 3; {number of chemical species}
   z_ele       = 110; {# of elements in periodic table}
   nsites      = 4*tdim; {sitelist dimension; standard 10*tdim}
   npth	       = 200;
   t_orb       = 80; {all orbits}
   t_sym       = 40;  {length of the list of symmetry related objects}
   t_obj       = 20;
   at_in_obj   = 200;
   at_of_node  = 200; {list of atoms attached to a NODE}
   obj_of_node = 20; {list of objects per tiling node}
   tsymop      = 3;
   atps	       = z_ele;
   natomrec    = 9;
   tfla	       = 2; {total num of flavours of a node, from -tfla to tfla}
   ttvl	       = 100; {NOTE: deco_parser has to be aware of this value!!!}
   nnodelist   = 2000;
Type
   nodelist = array[0..nnodelist] of integer;
   iele	    = array[1..t_ele] of integer;
   rele	    = array[1..t_ele] of myreal;
   v2	    = array[1..2] of myreal;
   v3	    = array[1..3] of myreal;
   v5	    = array[1..5] of myreal;
   i2	    = array[1..2] of integer;
   i3	    = array[1..3] of integer;
   i4	    = array[1..4] of integer;
   i5	    = array[1..5] of integer;
   i6	    = array[1..6] of integer;
   atomrec  = array[1..natomrec] of integer;
   i10	    = array[1..10] of integer;
   i010	    = array[0..10] of integer;
   i20	    = array[1..20] of integer;
   v10	    = array[1..10] of myreal;
   bool2    = array[1..2] of boolean;
   m5x5	    = array[1..5,1..5] of myreal;
   v33	    = array[1..3] of v3;
   v33list  = array[1..t_sym] of v33;
   i10x3    = array[-1..1] of i10;
   vpath    = array[1..npth] of integer; {depth of the lookup search path}
   vpathx3  = array[-1..1] of vpath;
   rsites   = array[1..nsites] of myreal;
   rsites3  = array[1..nsites] of v3;
Var	    
   debug,dbgs 			    : array[1..1000] of boolean;
   debug_msg			    : array[1..1000] of mystring;
   n_sym,n_orb,n_pxyz,n_obj,n_objch : integer;
   {symmetry}
   sym:array[1..t_sym] of i10;
   {basis}
   e,ep,epa,re: array[1..10] of v2;
   bs,infl: array[1..10] of i5;
   ba,bap: array[1..2] of v2;
   bl3,blt:v33;
   bai: array[1..2] of i5;
   {tiling objects}
   nu_offs,dpmodel:integer;
   obj_code,obj_mu,obj_nfla:array[1..t_obj] of integer;
   obj_nu:array[1..t_obj,1..t_sym] of integer;
   obj_nipat:array[1..t_obj] of integer;
   obj_nipth:array[1..t_obj] of integer;
   obj_pat: array[1..t_obj,-1..1] of i10;
   obj_ipat: array[1..t_obj,1..t_obj] of i10;
   obj_ipth: array[1..t_obj,1..npth] of integer;
   obj_pat_list:array[1..t_obj,1..t_sym,-1..1] of i10;
   obj_ipat_list:array[1..t_obj,1..t_sym,1..t_obj] of i10;
   obj_fla: array[1..t_obj,1..t_sym,1..tsymop] of integer;
   obj_nfl:array[1..t_obj] of integer;
   obj_inst:array[1..t_obj,1..npth] of integer;
   obj_flb:array[1..t_obj,1..t_sym,1..t_sym] of i2;
   obj_pth:array[1..t_obj] of integer;
   obj_pth_stat:array[1..t_obj,-1..1] of vpath;
   obj_pth_def:array[1..t_obj,1..t_sym] of vpath;
   obj_at_mu:array[1..t_obj,1..t_sym] of integer;
   obj_node:array[1..t_obj,-1..1] of integer;
   n_obj_ori:integer;
   obj_ori:array[1..t_obj*t_sym] of v2;
   ori2obj:array[1..t_obj*t_sym] of i2;
   obj0:array[1..t_obj,1..t_sym] of v5;
   obj_ham:array[1..t_obj] of myreal;
   obj_name,objcs:array[1..t_obj] of mystring;
   obj_st,obj_sta,obj_sta_u,obj_st_u,obj_stn:array[1..t_obj] of integer;
   obj_stx,obj_ch:array[1..t_obj] of myreal;
   obj_st_list:array[1..t_obj,1..t_sym] of integer;
   {atoms in objects}
   bi:array[1..t_obj,1..t_sym,1..at_in_obj] of atomrec;
   ra:array[1..t_obj,1..t_sym,1..at_in_obj] of v2;
   rz:array[1..t_obj,1..t_sym,1..at_in_obj] of real;
   ra5:array[1..t_obj,1..t_sym,1..at_in_obj] of v5;
   atp:array[1..t_obj,1..t_sym,1..at_in_obj] of i4;
   {tiling nodes}
   n2n:array[1..tdim,1..tdim] of boolean;
   m2m:array[1..tdim] of boolean;
   nipatot,nipthtot:integer;
Var
   tnodes      : integer;
   tnodes0     : integer;
   nan	       : array[1..tdim] of integer; {node.atoms mult}
   n_r	       : array[1..tdim,1..at_of_node] of v3; {node.atoms}
   n_r5	       : array[1..tdim,1..at_of_node] of v5; {node.atoms}
   n_a	       : array[1..tdim,1..at_of_node] of i5; {node.atoms.record}
   n_oc		     : array[1..tdim,1..at_of_node] of iele;
   n_para	     : array[1..tdim,1..at_of_node] of atomrec;
   n_objmu	     : array[1..tdim] of integer; {node.object.mult}
   n_objpo	     : array[1..tdim,1..obj_of_node] of i4; {node.(obj,obj_mu,po1,po2)}
   n_obj_fl,n_obj_cl : array[1..tdim,1..obj_of_node] of integer; {node_object flavour}
   lt		     : array[1..tdim] of i10; {connectivity table}
   ltm		     : array[1..tdim,-1..1] of i010;
   ltc		     : array[1..tdim,-1..1] of integer;
   nv,nu,nuinp,fl    : array[1..tdim] of integer; {edge mult, discrete-int-perp}
   tvl,tvls,tvlpo    : array[1..tdim] of integer; 
   nvm		     : array[1..tdim,-1..1] of integer;
   nn		     : i10; {edge-mult stat}
   eo		     : array[-2..2] of integer; {nu-stat}
   rt		     : array[1..tdim] of v3; {tiling nodes (real)}
   bt		     : array[1..tdim] of i5; {tiling nodes (5D)}
   {global parameters/constants}
   nat,natoms,maxorb:integer;
   o_frozen,osb: array[1..t_orb] of boolean;
   noche: array[1..t_orb] of integer;
   oche: array[1..t_orb] of iele;
   naoch: array[1..t_orb,0..z_ele] of integer;
   o3pxyz:array[1..t_orb,1..3] of integer;
   opxyz,pxyz:array[1..3*t_orb] of myreal; {positional parameters}
   dpxyz,d_pxyz,dpxyz_dr,dpxyz0,dpxyz_rms:array[1..3*t_orb] of rele; {changed chemical positional parameters}
   ch_pxyz:array[1..3*t_orb] of iele; {chemistry of given parameter&orbit}
   ndps: array[1..3*t_orb] of iele;
   nn_pxyz:array[1..3*t_orb] of integer; {number of elements in orbit}
   o_rel:array[1..t_orb] of boolean; {relaxation status of an orbit}
   pxyz2orb:array[1..3*t_orb] of integer;
   lpar:v2;
   pi,tau,eta,echpot:myreal;
   multi,ntocc:integer;
   ipos,iposd:integer; {R = ipos * r_ave + iposd * dr}
   {generalized flip}
   gsym,gsymch	   : array[1..20,1..20] of i10;
   omu,oob	   : array[1..t_orb] of integer;
   deco,dodfit,gbflip,flavours,repre5,export_occup,read_tvl  :boolean;
   seed:longint;
   id,inf:m5x5;
   lat_centered:boolean;
   perp_center:v2;
   {3D objects}
   io3d:integer;
   nnat:array[0..z_ele] of integer;
   pele:array[1..z_ele] of integer; {pointer CH -> list_of_CH}
   chp:array[0..z_ele] of myreal;
   nnele : integer; {actual number of chemistries}
   ele : array[1..t_ele] of integer; {pointer list_of_CH -> CH}
   deconame,ticoname,cromername:mystring;
   sigmaflip:boolean;
   nusta:array[-tfla..tfla] of integer;
   tlevels:integer;
   orbname:array[1..t_orb] of mystring;
   flip_instances,instances:boolean;
   nobcolors : array[1..t_obj] of integer;
   mele_nom,mele_oc	    : array[1..t_ele] of integer;
   buflim,chnom,chcur	    : array[0..z_ele] of integer;
   svn:integer;
   svlist:array[1..500] of integer; {work array}

implementation   

end.
